#pragma once
#include "OutputInterface.h"
#include <thread>
#include <string>
#include <atomic>
#include <concurrent_queue.h>

class LocalStream
	:public OutputInterface
{
public:
	LocalStream(const char* outFile);
	~LocalStream();
	virtual void BeginOutput(uint32_t w, uint32_t h, uint32_t frameRate) override;
	virtual void OutputVideoPacket(AVPacket* packet) override;
	virtual void EndOutput() override;

private:
	void Run(uint32_t w, uint32_t h, uint32_t frameRate);

	std::string m_fileName;
	std::thread m_worker;
	std::atomic_bool m_isRuning;

	concurrency::concurrent_queue<AVPacket*> m_videoPacketQueue;
};

